﻿/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
/**
 * @author Simon Oliver
 * @version 1.0
 */
 
/**
* Class to encapsulate the properties that could be applied to a lineStyle.
*/
package derek.util.drawing.styles
{
	import flash.display.Graphics;
	
	public class lineStyleFormat
	{
		public var thickness:Number;
		public var rgb:Number;
		public var alpha:Number;
		public var pixelHinting:Boolean;
	
		public var noScale:String;
		public var capsStyle:String;
		public var jointStyle:String;
		public var miterLimit:Number;
	
		public var dashLength:Number;
	
		private static var defaultLineStyle:lineStyleFormat;
		
		public function lineStyleFormat(tThickness:Number, tRgb:Number, tAlpha:Number = 100, tPixelHinting:Boolean = true, tNoScale:String = null, tCapsStyle:String =null, tJointStyle:String=null, tMiterLimit:Number=0,tDashLength:Number =0)
		{
			thickness=tThickness;
			rgb=tRgb;
			alpha=tAlpha;
			pixelHinting=tPixelHinting;
	
			noScale=tNoScale;
			capsStyle=tCapsStyle;
			jointStyle=tJointStyle;
			miterLimit=tMiterLimit;
	
			dashLength=tDashLength;
		}
	
		public function apply(graphics:Graphics):void
		{		
			graphics.lineStyle(thickness, rgb, alpha, pixelHinting, noScale, capsStyle, jointStyle, miterLimit);
		}
	
		public static function get defaultStyle():lineStyleFormat
		{
			if (!defaultLineStyle)
			{
				defaultLineStyle=new lineStyleFormat(0,0x000000,100);
			}
			return defaultLineStyle;
		}
	}
}